﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

namespace AbpBuild.Migrations
{
    public partial class eiditcaseReason : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            //migrationBuilder.DropTable(
            //    name: "Law");

            //migrationBuilder.DropTable(
            //    name: "LawDetail");

            //migrationBuilder.DropTable(
            //    name: "recordnoall");

            migrationBuilder.CreateTable(
                name: "caseReason",
                columns: table => new
                {
                    Id = table.Column<string>(nullable: false),
                    parent = table.Column<string>(nullable: true),
                    text = table.Column<string>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_caseReason", x => x.Id);
                    table.ForeignKey(
                        name: "FK_caseReason_Person",
                        column: x => x.parent,
                        principalTable: "caseReason",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "courtFullName",
                columns: table => new
                {
                    Id = table.Column<string>(nullable: false),
                    name = table.Column<string>(nullable: true),
                    region = table.Column<string>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_courtFullName", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "LawRecord",
                columns: table => new
                {
                    Id = table.Column<string>(nullable: false),
                    content = table.Column<string>(nullable: true),
                    Indexed = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_LawRecord", x => x.Id);
                });

            migrationBuilder.CreateIndex(
                name: "IX_caseReason_parent",
                table: "caseReason",
                column: "parent");
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "caseReason");

            migrationBuilder.DropTable(
                name: "courtFullName");

            migrationBuilder.DropTable(
                name: "LawRecord");

            migrationBuilder.CreateTable(
                name: "Law",
                columns: table => new
                {
                    LawID = table.Column<string>(type: "nvarchar(450)", nullable: false),
                    ImplementCode = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    ImplementDate = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    LawType = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Organ = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Other = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Path = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    StartDate = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Title = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Type = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Valid = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    ValidDate = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Law", x => x.LawID);
                });

            migrationBuilder.CreateTable(
                name: "LawDetail",
                columns: table => new
                {
                    ContentId = table.Column<string>(type: "nvarchar(450)", nullable: false),
                    Content = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    LawID = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Orders = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    PathName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Type = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    times = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_LawDetail", x => x.ContentId);
                });

            migrationBuilder.CreateTable(
                name: "recordnoall",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    conditionText = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    createtimes = table.Column<DateTime>(type: "datetime2", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_recordnoall", x => x.Id);
                });
        }
    }
}
